package com.yanqu.road.entity.activity.daomu.data;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.config.passroad.PassRoadInfo;
import com.yanqu.road.entity.util.PowerHelper;
import com.yanqu.road.utils.string.StringUtils;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_u_activity_daomu_user_data")
public class DaoMuActivityUserData extends DataObject {

    /**
     * 活动ID
     */
    private int activityId;

    /**
     * 玩家id
     */
    private Long userId;

    /**
     * 玩家区服ID
     */
    private long serverId;

    /**
     * 当前关卡ID
     */
    private int passesId;

    /**
     * 通过上一个关卡的时间
     */
    private long passPrePassesTime = 0;

    /**
     * 无尽模式-第几波
     */
    private int endlessWave;

    /**
     * 当前角色id
     */
    private int roleId;

    /**
     * 体力
     */
    private int energy;

    /**
     * 上次自然恢复体力时间
     */
    private long lastRestoreTime;

    /**
     * 活动内的道具（藏品激活道具，藏品碎片等）
     */
    private String prop = "";

    /**
     * 解锁的角色
     */
    private String unlockRoles = "";

    /**
     * 当前摸金进度宝箱ID
     */
    private int progressBoxId;

    /**
     * 摸金进度
     */
    private int boxProgress;

    /**
     * 是否通关0：否，1：是
     */
    private int passAllFlag;

    /**
     * 创建时间
     */
    private long createTime;

    /**
     * 更新时间
     */
    private long collectionScore;

    /**
     * 更新时间
     */
    private long updateTime;

    /**
     * 摸金等级
     */
    private int level;

    /**
     * 关卡击杀数MAP,存储转json
     */
    private Map<String, Integer> killNumJson = new ConcurrentHashMap<>();

    /**
     * 历史最高关卡
     */
    private int historyMaxPassesId;

    /**
     * 角色解锁，补发的镶金古玉MAP。k:角色ID,v:补发数量
     */
    private Map<String, Integer> roleJadeBfMap = new ConcurrentHashMap<>();

    /**
     * 关卡首通奖励领取记录
     */
    private Set<Integer> firstRewardRecord = new HashSet<>();

    /**
     * 摸金次数
     */
    private int drawBoxNum = 0;

    /**
     * 自选技能ID
     */
    private int selectSkillId = 0;

    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public int getActivityId() {
        return activityId;
    }

    public void setUserId(Long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public Long getUserId() {
        return userId;
    }

    public void setPassesId(int passesId) {
        if (this.passesId != passesId) {
            this.passesId = passesId;
            setOp(DataStatus.Update);
        }
    }

    public int getPassesId() {
        return passesId;
    }

    public void setRoleId(int roleId) {
        if (this.roleId != roleId) {
            this.roleId = roleId;
            setOp(DataStatus.Update);
        }
    }

    public int getRoleId() {
        return roleId;
    }

    public void setCreateTime(long createTime) {
        if (this.createTime != createTime) {
            this.createTime = createTime;
            setOp(DataStatus.Update);
        }
    }

    public long getCreateTime() {
        return createTime;
    }

    public int getEnergy() {
        return energy;
    }

    public void setEnergy(int energy) {
        if (this.energy != energy) {
            this.energy = energy;
            setOp(DataStatus.Update);
        }
    }

    public long getLastRestoreTime() {
        return lastRestoreTime;
    }

    public void setLastRestoreTime(long lastRestoreTime) {
        if (this.lastRestoreTime != lastRestoreTime) {
            this.lastRestoreTime = lastRestoreTime;
            setOp(DataStatus.Update);
        }
    }

    public String getProp() {
        return prop;
    }

    public void setProp(String prop) {
        if (!this.prop.equals(prop)) {
            this.prop = prop;
            setOp(DataStatus.Update);
        }
    }

    public int getEndlessWave() {
        return endlessWave;
    }

    public void setEndlessWave(int endlessWave) {
        if (this.endlessWave != endlessWave) {
            this.endlessWave = endlessWave;
            setOp(DataStatus.Update);
        }
    }

    public long getPassPrePassesTime() {
        return passPrePassesTime;
    }

    public void setPassPrePassesTime(long passPrePassesTime) {
        if (this.passPrePassesTime != passPrePassesTime) {
            this.passPrePassesTime = passPrePassesTime;
            setOp(DataStatus.Update);
        }
    }

    public String getUnlockRoles() {
        return unlockRoles;
    }

    public void setUnlockRoles(String unlockRoles) {
        if (!this.unlockRoles.equals(unlockRoles)) {
            this.unlockRoles = unlockRoles;
            setOp(DataStatus.Update);
        }
    }

    public long getServerId() {
        return serverId;
    }

    public void setServerId(long serverId) {
        if (this.serverId != serverId) {
            this.serverId = serverId;
            setOp(DataStatus.Update);
        }
    }

    public int getProgressBoxId() {
        return progressBoxId;
    }

    public void setProgressBoxId(int progressBoxId) {
        if (this.progressBoxId != progressBoxId) {
            this.progressBoxId = progressBoxId;
            setOp(DataStatus.Update);
        }
    }

    public int getBoxProgress() {
        return boxProgress;
    }

    public void setBoxProgress(int boxProgress) {
        if (this.boxProgress != boxProgress) {
            this.boxProgress = boxProgress;
            setOp(DataStatus.Update);
        }
    }

    public int getPassAllFlag() {
        return passAllFlag;
    }

    public void setPassAllFlag(int passAllFlag) {
        if (this.passAllFlag != passAllFlag) {
            this.passAllFlag = passAllFlag;
            setOp(DataStatus.Update);
        }
    }

    public long getCollectionScore() {
        return collectionScore;
    }

    public void setCollectionScore(long collectionScore) {
        if (this.collectionScore != collectionScore) {
            this.collectionScore = collectionScore;
            setOp(DataStatus.Update);
        }
    }

    public long getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(long updateTime) {
        if (this.updateTime != updateTime) {
            this.updateTime = updateTime;
            setOp(DataStatus.Update);
        }
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        if (this.level != level) {
            this.level = level;
            setOp(DataStatus.Update);
        }
    }

    public int getHistoryMaxPassesId() {
        return historyMaxPassesId;
    }

    public void setHistoryMaxPassesId(int historyMaxPassesId) {
        if (this.historyMaxPassesId != historyMaxPassesId) {
            this.historyMaxPassesId = historyMaxPassesId;
            setOp(DataStatus.Update);
        }
    }

    public Map<String, Integer> getKillNumJson() {
        return killNumJson;
    }

    public void setKillNumJson(Map<String, Integer> killNumJson) {
        this.killNumJson = killNumJson;
        setOp(DataStatus.Update);
    }

    public int getDrawBoxNum() {
        return drawBoxNum;
    }

    public void setDrawBoxNum(int drawBoxNum) {
        this.drawBoxNum = drawBoxNum;
    }

    public Map<String, Integer> getRoleJadeBfMap() {
        return roleJadeBfMap;
    }

    public void setRoleJadeBfMap(Map<String, Integer> roleJadeBfMap) {
        this.roleJadeBfMap = roleJadeBfMap;
        setOp(DataStatus.Update);
    }

    public void putRoleJadeBf(String roleId, int num) {
        this.roleJadeBfMap.put(roleId, num);
        setOp(DataStatus.Update);
    }

    public void removeRoleJadeBf(String roleId) {
        this.roleJadeBfMap.remove(roleId);
        setOp(DataStatus.Update);
    }

    public Set<Integer> getFirstRewardRecord() {
        return firstRewardRecord;
    }

    public void setFirstRewardRecord(Set<Integer> firstRewardRecord) {
        this.firstRewardRecord = firstRewardRecord;
        setOp(DataStatus.Update);
    }

    public void addFirstRewardRecord(int passesId) {
        this.firstRewardRecord.add(passesId);
        setOp(DataStatus.Update);
    }

    public int getSelectSkillId() {
        return selectSkillId;
    }

    public void setSelectSkillId(int selectSkillId) {
        if (this.selectSkillId != selectSkillId) {
            this.selectSkillId = selectSkillId;
            setOp(DataStatus.Update);
        }
    }
}
